/*轮播图*/
var swiper = new Swiper('.swiper-container', {
    slidesPerView: 1,
    spaceBetween: 30,
    loop: true,
    autoplay:true,
    pagination: {
        el: '.swiper-pagination',
        clickable: true,
    },
    navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
    },
});
/*选项卡*/
var btn1 = document.querySelector("#btn1");
var btn2 = document.querySelector("#btn2");
var btn3 = document.querySelector("#btn3");
var btn4 = document.querySelector("#btn4");
var tab_text = document.querySelectorAll(".tab_text > div");
btn1.addEventListener('mouseover',function(){
    tab_text[0].style.display="block";
});
btn1.addEventListener('mouseleave',function(){
    tab_text[0].style.display="none";
});
tab_text[0].addEventListener('mouseover',function(){
    tab_text[0].style.display="block";
});
tab_text[0].addEventListener('mouseleave',function(){
    tab_text[0].style.display="none";
});
btn2.addEventListener('mouseover',function(){
    tab_text[1].style.display="block";
});
btn2.addEventListener('mouseleave',function(){
    tab_text[1].style.display="none"
})
tab_text[1].addEventListener('mouseover',function(){
    tab_text[1].style.display="block";
});
tab_text[1].addEventListener('mouseleave',function(){
    tab_text[1].style.display="none";
});
btn3.addEventListener('mouseover',function(){
    tab_text[2].style.display="block";
});
btn3.addEventListener('mouseleave',function(){
    tab_text[2].style.display="none";
});
tab_text[2].addEventListener('mouseover',function(){
    tab_text[2].style.display="block";
});
tab_text[2].addEventListener('mouseleave',function(){
    tab_text[2].style.display="none";
});
btn4.addEventListener('mouseover',function(){
    tab_text[3].style.display="block";
});
btn4.addEventListener('mouseleave',function(){
    tab_text[3].style.display="none";
});
tab_text[3].addEventListener('mouseover',function(){
    tab_text[3].style.display="block";
});
tab_text[3].addEventListener('mouseleave',function(){
    tab_text[3].style.display="none";
});
/*返回顶部*/
var toTop = document.querySelector("#totop");
window.onscroll = function(){
    console.log(document.body.scrollTop);
    if(document.documentElement.scrollTop>694||document.body.scrollTop>694){
        toTop.style.display="block";
    }else {
        toTop.style.display="none";
    }
};
toTop.addEventListener("click",function(){
    //window.scrollTo(0,0);

    //这个是过渡回到顶部的事件,只能在新版浏览器显示
    window.scrollTo({
     top: 0,
     behavior: 'smooth'
     });
});